//
//  QQNGetRect.m
//  Wedding
//
//  Created by QQn1993 on 15/12/4.
//  Copyright (c) 2015年 QQn1993. All rights reserved.
//

#import "QQNGetRect.h"

@implementation QQNGetRect

+ (CGRect) string:(NSString *)str font:(NSInteger)size
{
    //    定义字典，存储label上的字体等信息
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:size]};
    //    通过字典计算高度和宽度
    CGRect rect = [str boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return rect;
}

+ (CGRect) string:(NSString *)str font:(NSInteger)size AndWidth:(CGFloat)width
{
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:size]};
    //    通过字典计算高度和宽度
    CGRect rect = [str boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return rect;
}

@end
